package com.jinke.api.modules.ums.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jinke.api.modules.ums.mapper.SystemConfigMapper;
import com.jinke.api.modules.ums.model.SystemConfig;
import com.jinke.api.modules.ums.service.SystemConfigService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 配置表 服务实现类
 * </p>
 *
 * @author macro
 * @since 2024-01-16
 */
@Service
public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigMapper, SystemConfig> implements SystemConfigService {

    @Override
    public SystemConfig getByKey(String name) {
        LambdaQueryWrapper<SystemConfig> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SystemConfig::getConfigKey, name);
        queryWrapper.last("LIMIT 1");
        return getOne(queryWrapper);
    }

}
